package c.h.a.m0.s;

import android.content.Context;
import android.hardware.camera2.CameraManager;
import android.os.Build.VERSION;

/* compiled from: TorchControlCompat */
public class d implements b {
    public b a;

    public d(Context context) {
        CameraManager cameraManager = (CameraManager) context.getSystemService("camera");
        if (cameraManager == null) {
            throw new IllegalStateException("cameraManager is null");
        } else if (VERSION.SDK_INT >= 23) {
            this.a = new e(cameraManager);
        } else {
            this.a = new c(cameraManager);
        }
    }

    public void a() {
        b bVar = this.a;
        if (bVar != null) {
            bVar.a();
        }
    }

    public void b() {
        b bVar = this.a;
        if (bVar != null) {
            bVar.b();
        }
    }

    public void release() {
        b bVar = this.a;
        if (bVar != null) {
            bVar.release();
        }
    }
}
